<!DOCTYPE html>
  <html>
  <head>
      <meta charset="utf-8">
      <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
      <title>title</title>
      <link rel="stylesheet" type="text/css" href="../css/api.css"/>
      <style>
      .header{
            width: 93%;
            height: 2.5rem;
            line-height: 2.5rem;
            padding: 0.5rem 0.8rem;
            text-align: center;
            position: fixed;
            top:1.5rem;
            background-color: #fff;
            z-index: 999;
        }
      .header_img{
        width: 6%;
        height: 45%;
        float: left;
        margin-top: 0.5rem;
      }
      .header_img img{
        width: 100%;
        height: 100%;
      }
      .header h3{
        line-height: 3rem;
        width: 90%;
        margin-left: 0.7rem;
        text-align: center;
      }
      .fl{
        float: left;
      }
      .fr{
        float: right;
      }
      .math{
        width: 93%;
        height: 100%;
        position: fixed;
        margin-top:5rem;

        padding:1rem 0.8rem;
        overflow: scroll;
      }
      .math_one{
        width:93%;
        height:10%;
        min-height: 3rem;
        background-color: rgb(242, 242, 242, 0.5);
        margin-bottom: 1rem;
        border-radius: 0.5rem;
        padding: 0.5rem 0.8rem;

      }
      .one_o{
        width: 95%;
        height:10%;

        position: relative;
      }
      .math_left{
        width: 90%;
        height: 100%;
      font-size: 0.9rem;

      }
      .left_p{
        position: absolute;
        top: 3.7rem;
        font-size: 0.8rem;
        color: #51321a;

      }
      .math_right{

        background-color:#40cccc;
        width: auto;
        height: 1.5rem;
        text-align: center;
        line-height: 1.5rem;
        color: #fff;
        font-size: 0.9rem;
        position: absolute;
        border-radius: 0.3rem;
        bottom: -4rem;
        right:-1.5rem;

      }
      .math_rights{
        width: 1.5rem;
        height: 1.5rem;
        position: relative;
        right:0.5rem;
        bottom:rem;
        /*border: 0.1rem solid red;*/
        /*border: 0.1rem solid red;*/
        z-index: 999;
      }
      .p1{
        /*font-weight: bold;*/
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp:3;
        -webkit-box-orient:vertical;
      }
      </style>
  </head>
  <body>
    <div class="header">
      <div class="header_img">
        <img src="../image/u18.png" alt="" onclick="closewin()">
      </div>
      <h3>作业明细</h3>
    </div>
    <!-- 内容 -->
    <div class="math" id="cur_list">



    </div>
  </body>
  <script type="text/javascript" src="../script/api.js"></script>
  <script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript" src="../script/jquery-1.8.3.js"></script>
  <script type="text/javascript">
  var id
  var userinfo=$api.getStorage('userinfo')
      apiready = function(){
        id = api.pageParam.id

        get_zylist()
        api.addEventListener({
      			name:'add_zy',
      			extra:{
      					threshold:0
      			}
      	}, function(ret, err){
                get_zylist()
      	});
      };
      function get_zylist() {
        var html =''
        var obj = $api.byId('cur_list');

        api.ajax({
            url: SITE_URL+'cur_api/zylist/get_some',
            method: 'post',
            data: {
                values: {
                    id: id,
                    user_id:userinfo.id
                }
            }
        },function(ret, err){
            if (ret) {
              if(ret.error==200){
                if(ret.data.length>0){
                  for (var i = 0; i < ret.data.length; i++) {
                    var dat = ret.data[i]
                    html +='<div class="math_one">'
                    html +='<div class="one_o">'
                    html +='<div class="math_left fl">'
                    html +='<p class="p1">'+dat.name+'</p>'
                    html +='<p class="left_p">'+dat.start_time+'</p>'
                    html +='</div>'
                    html +='<div class="math_right fr">'
                    if(dat.py_is==1){
                      html +='<p>已批阅('+dat.py+')</p>'
                    }else if(dat.py_is==0){
                      html +='<p>待批阅</p>'
                    }else{
                      html +='<p onclick="go_zy('+dat.id+')">写作业</p>'
                    }

                    html +='</div>'
                    html +='</div>'
                    html +='</div>'
                  }
                  $api.html(obj, html);

                }
              }else{
                msgcode('该课程暂无作业')
              }
                //alert( JSON.stringify( ret ) );
            } else {
              msgcode('请检查网络连接')
                //alert( JSON.stringify( err ) );
            }
        });

      }

      function go_zy(id) {
        api.openWin({
            name: 'go_zy',
            url: './go_zy.html',
            pageParam: {
                        id: id,

                    }
        });
      }
  </script>
  </html>
